package com.potenza.training.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.potenza.training.resume.dao.ResumeHopeDao;
import com.potenza.training.resume.entity.ResumeHope;
import com.potenza.training.resume.service.ResumeHopeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("resumeHopeService")
public class ResumeHopeServiceImpl extends ServiceImpl<ResumeHopeDao, ResumeHope> implements ResumeHopeService {

    @Autowired
    ResumeHopeDao resumeHopeDao;

    @Override
    public void saveResumeHope(ResumeHope resumeHope) {
        this.save(resumeHope);
    }

    @Override
    public List<ResumeHope> findAll(Integer userId) {
        QueryWrapper<ResumeHope> resumeHopeQueryWrapper = new QueryWrapper<>();
        resumeHopeQueryWrapper.lambda().eq(ResumeHope::getResumeId,userId);

        return  resumeHopeDao.selectList(resumeHopeQueryWrapper);
    }

    @Override
    public void updateResumeHope(ResumeHope resumeHope) {
        this.updateById(resumeHope);
    }
}